﻿<div class="blade-static __bottom">
    <button class="btn" ng-click="startExport()" ng-disabled="!canStartProcess() || blade.notification">
        <span>Start export</span>
    </button>
</div>
<div class="blade-content">
    <div class="blade-inner">
        <div class="inner-block">
            <form class="form ng-pristine ng-valid" ng-if="!blade.notification">
                <fieldset>
                    <legend>Platform entries</legend>
                    <div class="list __items">
                        <label class="list-item">
                            <input type="checkbox" ng-model="exportRequest.handleSecurity">
                            <span class="switch"></span>
                            <span class="list-name">Security</span>
                            <span class="list-descr">Accounts and roles</span>
                        </label>
                        <label class="list-item">
                            <input type="checkbox" ng-model="exportRequest.handleBinaryData">
                            <span class="switch"></span>
                            <span class="list-name">Binary</span>
                            <span class="list-descr">Binary data</span>
                        </label>
                        <label class="list-item">
                            <input type="checkbox" ng-model="exportRequest.handleSettings">
                            <span class="switch"></span>
                            <span class="list-name">Settings</span>
                            <span class="list-descr"></span>
                        </label>
                    </div>
                </fieldset>
                <fieldset>
                    <legend>Choose modules to export</legend>
                    <div class="list __items">
                        <label class="list-item" ng-repeat="data in exportRequest.exportManifest.modules">
                            <input type="checkbox" ng-model="data.isChecked" ng-change="updateModuleSelection()">
                            <span class="switch"></span>
                            <span class="list-name">{{data.id}}</span>
                            <span class="list-descr">{{data.description}}</span>
                        </label>
                    </div>
                </fieldset>
            </form>
          
            <div class="form" ng-if="blade.notification">
                <div class="block">
                    <div>
                        <div class="sub-t">{{blade.notification.description}}</div>
                        <div class="block" ng-if="blade.notification.created || blade.notification.finished">
                            <p ng-if="blade.notification.created" ng-class="{'no-data': blade.notification.created}" class="text">Start — <i class="fa fa-clock-o"></i> <span am-time-ago="blade.notification.created"></span></p>
                            <p ng-if="blade.notification.finished" ng-class="{'no-data': blade.notification.finished}" class="text">End — <i class="fa fa-clock-o"></i> <span am-time-ago="blade.notification.finished"></span></p>
                        </div>
                        <div ng-if="blade.notification.errorCount > 0">
                            <span class="sub-t">Errors</span>
                            <div class="log">
                                <p ng-repeat="error in blade.notification.errors track by $index" class="error">{{error}}</p>
                            </div>
                        </div>
                        <p class="text" ng-if="blade.notification.downloadUrl">Download Url: <a href="{{blade.notification.downloadUrl}}" target="_blank">{{blade.notification.downloadUrl}}</a></p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>